/**

 * @author zhaokai

 * @date 2019-10-31 22:09

 */
let fs = require('fs');
//1 文件的读写
fs.readFile('test.txt',function (err,data) {
    console.log(data.toLocaleString());
});
let data = fs.readFileSync('test.txt');
console.log(data);

fs.open('test.txt', 'r+', function (err, fd) {
    console.log('open file');
    console.log(fd);
});

fs.copyFile('t.txt', 't2.txt', (err) => {
    if (err) throw err;
    console.log('源文件已拷贝到目标文件');
});

fs.copyFileSync('t.txt','t2.txt');
